package schedulo.gui;

import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

public class TaskProviderListCellRenderer implements ListCellRenderer {

	private JLabel label;
	
	public TaskProviderListCellRenderer() {
		label = new JLabel();
	}
	
	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
		if (isSelected) {
			label.setForeground(list.getSelectionForeground());
			label.setBackground(list.getSelectionBackground());
		}
		else {
			label.setForeground(list.getForeground());
			label.setBackground(list.getBackground());
		}
		label.setText("index: " + index);
		return label;
	}

}

